package com.menker.app.ui.main;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import com.github.lzyzsd.jsbridge.BridgeWebView;

/**
 * Created by developer on 17-8-18.
 */

public class SlidingViewPager extends ViewPager {

    public SlidingViewPager(Context context) {
        super(context);
    }

    public SlidingViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        boolean b = super.onTouchEvent(ev);
        if (ev.getAction() == MotionEvent.ACTION_MOVE) {
            System.out.println("viewPager---" + b);
            return false;
        }

        return super.onTouchEvent(ev);
    }

    @Override
    protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {

        if (v instanceof BridgeWebView) {
            return true;
        } else {
            return super.canScroll(v, checkV, dx, x, y);
        }
    }
}
